package demo5;
public class Test5 {
    public static void test1(Animal animal){
        animal.eat();
    }
    public static void test2(IFlying iFlying){
        iFlying.fly();
    }
    public static void main1(String[] args) {
        test1(new Brid("秋雪",19));
        test1(new Dog("黄黄",19));
    }

    public static void main2(String[] args) {
        test2(new Brid("玥玥",19));
    }



}


interface IFlying{
    void fly();
}

interface ISwimming{
    void swim();
}

interface IRunning{
    void run();
}

abstract class Animal{
    private String name;
    private int age;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public Animal(String name, int age){
        this.name = name;
        this.age = age;
    }
    public abstract void eat();
}

class Dog extends Animal implements IRunning,ISwimming{

    public Dog(String name, int age) {
        super(name, age);
    }

    @Override
    public void swim() {
        System.out.println(this.getName() + "正在游泳");
    }

    @Override
    public void run() {
        System.out.println(this.getName() + "正在跑步");
    }

    @Override
    public void eat() {
        System.out.println(this.getName() + "正在吃狗粮");
    }
}

class Brid extends Animal implements IFlying{

    public Brid(String name, int age) {
        super(name, age);
    }

    @Override
    public void eat() {
        System.out.println(this.getName() + "正在吃");
    }

    @Override
    public void fly() {
        System.out.println(this.getName() + "正在飞");
    }
}

interface A{
    void testA();
}

interface B{
    void testB();
}

interface C extends A,B{
    void testC();
}


class D implements C{

    @Override
    public void testA() {
        System.out.println("=======");
    }

    @Override
    public void testB() {
        System.out.println("=======");
    }

    @Override
    public void testC() {
        System.out.println("=======");
    }
}
